#include <iostream>
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <sys/mman.h>
using namespace std;
int main(int argc,char* argv[])
{
    open("/dev/null",O_RDONLY);
    int fd=open("./lsof_test.cpp",O_RDWR);
    mmap(NULL,1,PROT_READ,MAP_PRIVATE,fd,0);
    perror("mmap");
    
    
    fd = open("./deleted_file",O_CREAT|O_RDWR, S_IRWXU);
    char line[]="one line\none line\none line\none line\none line\none line\none line\none line\none line\none line\none line\none line\none line\none line\none line\none line\none line\none line\none line\none line\none line\n";
    write(fd,line,sizeof(line));
    getchar();
    unlink("./deleted_file");
    getchar();
    return 0;
}